#pragma once

class CVector3f;


class CMatrix
{
public:

	//array representing the matrix
	//m_array[ROW][COLUMN]
	float m_array[4][4];

public:
	CMatrix();
	~CMatrix();

	void display()const;

	void identity();
	CMatrix inverse() const;

	CMatrix operator+(const CMatrix& m)const;
	CMatrix operator-(const CMatrix& m)const;
	CMatrix operator*(const CMatrix& m)const;
	CVector3f operator*(const CVector3f& v)const;
	void operator+=(const CMatrix& m);
	void operator-=(const CMatrix& m);
	void operator=(const CMatrix& m)const;

	void createTranslation(float x, float y , float z);
	void createTranslation(const CVector3f& v);
	void createRotationX(float radiusAngle);
	void createRotationY(float radiusAngle);
	void createRotationZ(float radiusAngle);
	void createRotation(const CVector3f& axis, float angle);
	void createScale(const CVector3f& s);
	void createScale(float s);

	//convert the matrix to an opengl matrix (column major)
	void getOpenGLMatrix(double* matrix);

	//calculate frenet matrix
	void createFrenet(const CVector3f& position, const CVector3f& direction, const CVector3f& up);

	//build a matrix using three vectors as columns
	void buildColumn(const CVector3f& c1, const CVector3f& c2, const CVector3f& c3);

	//calculate the determinant
	float det()const;


};
